package com.xqb.modules.service.impl;

import com.xqb.common.utils.DateUtils;
import com.xqb.modules.domain.po.LesSubject;
import com.xqb.modules.mapper.LesSubjectMapper;
import com.xqb.modules.service.ILesSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 题目Service业务层处理
 * 
 * @author xqb
 * @date 2024-10-14
 */
@Service
public class LesSubjectServiceImpl implements ILesSubjectService 
{
    @Autowired
    private LesSubjectMapper lesSubjectMapper;

    /**
     * 查询题目
     * 
     * @param id 题目主键
     * @return 题目
     */
    @Override
    public LesSubject selectLesSubjectById(Long id)
    {
        return lesSubjectMapper.selectLesSubjectById(id);
    }

    /**
     * 查询题目列表
     * 
     * @param lesSubject 题目
     * @return 题目
     */
    @Override
    public List<LesSubject> selectLesSubjectList(LesSubject lesSubject)
    {
        return lesSubjectMapper.selectLesSubjectList(lesSubject);
    }

    /**
     * 新增题目
     * 
     * @param lesSubject 题目
     * @return 结果
     */
    @Override
    public int insertLesSubject(LesSubject lesSubject)
    {
        lesSubject.setCreateTime(DateUtils.getNowDate());
        return lesSubjectMapper.insertLesSubject(lesSubject);
    }

    /**
     * 修改题目
     * 
     * @param lesSubject 题目
     * @return 结果
     */
    @Override
    public int updateLesSubject(LesSubject lesSubject)
    {
        lesSubject.setUpdateTime(DateUtils.getNowDate());
        return lesSubjectMapper.updateLesSubject(lesSubject);
    }

    /**
     * 批量删除题目
     * 
     * @param ids 需要删除的题目主键
     * @return 结果
     */
    @Override
    public int deleteLesSubjectByIds(Long[] ids)
    {
        return lesSubjectMapper.deleteLesSubjectByIds(ids);
    }

    /**
     * 删除题目信息
     * 
     * @param id 题目主键
     * @return 结果
     */
    @Override
    public int deleteLesSubjectById(Long id)
    {
        return lesSubjectMapper.deleteLesSubjectById(id);
    }
}
